package com.yangyang.rpc;

import com.yangyang.rpc.db.StudentInfoCache;
import com.yangyang.rpc.server.SNoProtocol;
import com.yangyang.rpc.server.SNoRpcServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.Server;

import java.io.IOException;

public class App {

    public static void main(String[] args) throws IOException {
        StudentInfoCache studentInfoCache = new StudentInfoCache();
        Server server = new RPC.Builder(new Configuration()).setProtocol(SNoProtocol.class)
                .setInstance(new SNoRpcServer(studentInfoCache)).setBindAddress("127.0.0.1").setPort(8000)
                .setNumHandlers(5).build();
        server.start();
    }

}
